package com.tangsm.spring.boot.springdoc;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

/**
 * Spring Boot Springdoc 集成实例
 * @author tangsm
 * @date 2021-07-26
 */
@SpringBootApplication
public class SpringdocApplication {

    private static final Logger log = LoggerFactory.getLogger(SpringdocApplication.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(SpringdocApplication.class, args);

        Environment env = application.getEnvironment();

        // 服务端口
        String port = env.getProperty("server.port");
        // 服务上下文
        String path = env.getProperty("server.servlet.context-path");

        log.info("\n----------------------------------------------------------\n\t" +
                "Application Jeecg-Boot is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
                "----------------------------------------------------------");
    }
}
